package com.imut.lagain.entity;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.annotation.*;
import jakarta.persistence.Column;
import jakarta.persistence.PreUpdate;
import java.time.LocalDateTime;

/**
 * 呼吸练习实体类
 */
@TableName("breathing_exercise")
public class BreathingExercise {
    private static final Logger log = LoggerFactory.getLogger(BreathingExercise.class);

    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("exercise_id")
    private String exerciseId;

    @TableField("user_id")
    private Long userId;

    @TableField("session_id")
    private String sessionId;

    @TableField("exercise_type")
    private String exerciseType; // 4-7-8/box/triangle/custom

    @TableField("inhale_duration")
    private Integer inhaleDuration;

    @TableField("hold_duration")
    private Integer holdDuration;

    @TableField("exhale_duration")
    private Integer exhaleDuration;

    @TableField("pause_duration")
    private Integer pauseDuration;

    @TableField("total_cycles")
    private Integer totalCycles;

    @TableField("completed_cycles")
    private Integer completedCycles = 0;

    @TableField("start_time")
    private LocalDateTime startTime;

    @TableField("end_time")
    private LocalDateTime endTime;

    @TableField("status")
    private String status; // active/completed/paused/abandoned

    @TableField("effectiveness_rating")
    private Integer effectivenessRating;

    @TableField("anxiety_level")
    private Integer anxietyLevel;

    @TableField("current_anxiety_level")
    private Integer currentAnxietyLevel;

    @TableField("notes")
    private String notes;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @Column(name = "updated_at")
    private LocalDateTime updatedAt;

    @Column(name = "is_deleted")
    private Boolean isDeleted = false;

    public BreathingExercise() {
        this.createdAt = LocalDateTime.now();
        this.updatedAt = LocalDateTime.now();
        this.status = "pending";
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getExerciseId() {
        return exerciseId;
    }

    public void setExerciseId(String exerciseId) {
        this.exerciseId = exerciseId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    public String getExerciseType() {
        return exerciseType;
    }

    public void setExerciseType(String exerciseType) {
        this.exerciseType = exerciseType;
    }

    public Integer getInhaleDuration() {
        return inhaleDuration;
    }

    public void setInhaleDuration(Integer inhaleDuration) {
        this.inhaleDuration = inhaleDuration;
    }

    public Integer getHoldDuration() {
        return holdDuration;
    }

    public void setHoldDuration(Integer holdDuration) {
        this.holdDuration = holdDuration;
    }

    public Integer getExhaleDuration() {
        return exhaleDuration;
    }

    public void setExhaleDuration(Integer exhaleDuration) {
        this.exhaleDuration = exhaleDuration;
    }

    public Integer getPauseDuration() {
        return pauseDuration;
    }

    public void setPauseDuration(Integer pauseDuration) {
        this.pauseDuration = pauseDuration;
    }

    public Integer getTotalCycles() {
        return totalCycles;
    }

    public void setTotalCycles(Integer totalCycles) {
        this.totalCycles = totalCycles;
    }

    public Integer getCompletedCycles() {
        return completedCycles;
    }

    public void setCompletedCycles(Integer completedCycles) {
        this.completedCycles = completedCycles;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getEffectivenessRating() {
        return effectivenessRating;
    }

    public void setEffectivenessRating(Integer effectivenessRating) {
        this.effectivenessRating = effectivenessRating;
    }

    public Integer getAnxietyLevel() {
        return anxietyLevel;
    }

    public void setAnxietyLevel(Integer anxietyLevel) {
        this.anxietyLevel = anxietyLevel;
    }

    public Integer getCurrentAnxietyLevel() {
        return currentAnxietyLevel;
    }

    public void setCurrentAnxietyLevel(Integer currentAnxietyLevel) {
        this.currentAnxietyLevel = currentAnxietyLevel;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Boolean getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    @PreUpdate
    public void preUpdate() {
        this.updatedAt = LocalDateTime.now();
    }
}